import { Router, Route, Switch } from 'react-router-dom'
// import AuthRoute from 'components/AuthRoute'
// import { hasToken } from 'utils/storage'
// import { Redirect } from 'react-router-dom'

// import Home from 'pages/Layout'
import Login from 'pages/Login'
import Layout from 'pages/Layout'
import PrivateRoute from 'components/PrivateRoute'
import history from 'utils/history'
/**
 *  import {HashRouter} from 'react-router-dom'
 *
 *  HashRouter = <Router history={createHashHistory()}></Router>
 *  BrowserRouter = <Router history={createBrowserHistory()}></Router>
 */

function App() {
  return (
    <Router history={history}>
      <div className="App">
        {/* <Link to="/login">登录</Link>
        <Link to="/home">首页</Link> */}

        {/* 配置路由规则 */}
        <Switch>
          <PrivateRoute path="/home" component={Layout}></PrivateRoute>
          <Route path="/login" component={Login}></Route>
          {/* 配置一个404组件 */}
        </Switch>
      </div>
    </Router>
  )
}

export default App
